﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using PhotoHsn.BLL.Adapters;
using PhotoHsn.BLL;
using Bxas.Core.Exceptions;
using System.Web.UI;

namespace PhotoHsn.BLL
{

    [Serializable]
    public class BxasException : Bxas.Core.Exceptions.BxasCoreException
    {

        public BxasException(Page page,string message,BxasCoreException ex)
            : base(message,ex)
        {

            this.HataTuru = ex.HataTuru;
            ProjectErrorsBs projectErrorBs = new ProjectErrorsBs();
            ProjectErrors projectErrors = new ProjectErrors();
            projectErrors.Cls = page.Request.Url.ToString();
            projectErrors.ErrorCode = this.GetHashCode().ToString();
            projectErrors.ErrorDate = DateTime.Now;
            //  projectErrors.Func = this.GetMethod().Name;
            projectErrors.Id = Guid.NewGuid();
            projectErrors.Message = this.Message;
            projectErrorBs.insert(projectErrors);

        }


        public string ResolveMessage
        {
            get
            {
                if (this.HataTuru == EnumaHataTuru.web)
                    return this.Message;
                else
                    return ExceptionFormatter.ResolveException(this);
            }
        }

       

    }


}
